package com.LinkedList;

import java.util.Random;

/**
 * 面向对象的链表方式
 */
public class MainLink {
    private static final String CLASS_NAME = "2018级计算机科学与技术师范02班";
    private static final String STU_ID_PREFIX = "2018312210";

    public static void main(String[] args) {
        String[] stuName = getStuNames();
        UserInfo last = new UserInfo(STU_ID_PREFIX + "01", stuName[1], getBirthday(), CLASS_NAME, new UserInfo());
        for (int i = 2; i < stuName.length; i++) {
            String stuIDSuffix = i < 10 ? "0" + i : "" + i;
            UserInfo tmp = new UserInfo(STU_ID_PREFIX + stuIDSuffix, stuName[i], getBirthday(), CLASS_NAME);
            System.out.println(last + "\n");
            last.stuNext = tmp;
            last = tmp;
        }
        System.out.println(last + "\n");
    }

    /**
     * @return 随机生成生日
     */
    private static String getBirthday() {
        Random random = new Random();
        return "" + (1998 + random.nextInt(3)) + "-" + getMonth() + "-" + getDay();
    }

    private static String getDay() {
        Random random = new Random();
        int dayInt = (1 + random.nextInt(31));
        return dayInt > 9 ? "" + dayInt : "0" + dayInt;
    }

    private static String getMonth() {
        Random random = new Random();
        int monthInt = (1 + random.nextInt(12));
        return monthInt > 9 ? "" + monthInt : "0" + monthInt;
    }

    /**
     * @return 同学名单
     */
    private static String[] getStuNames() {
        return new String[]{"", "丁良健", "马文靖", "毛婷", "付裕", "伍岳梅", "刘思孝", "刘淼", "孙晨", "李梦亭", "肖辰仪", "肖玲慧", "吴东林", "佘广湘", "陈炎", "易美琴", "易晓霞", "罗湘云", "胡小菊", "胡静宇", "钟程华", "饶涛", "袁毅翔", "徐娇", "高航", "唐文荣", "唐咏成", "唐海兰", "唐翠仙", "黄文龙", "黄嘉", "蒋艳", "喻明亮", "雷博丞", "蔡娜娜", "谭张雅玉", "汪胜斌", "徐锋飚", "唐佳瑾"};
    }
}
